package com.hexinfo.dmpro.demo.controller;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import com.hexinfo.dmpro.demo.model.TTest;
import com.hexinfo.dmpro.demo.model.Test;
import com.hexinfo.dmpro.demo.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@AllArgsConstructor
@RequestMapping("/test" )
@Api(value = "test", tags = "测试查询")
public class TestController {

    private final TestService testService;


    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    @AnonymousAccess
    public ResponseEntity<Object> getTest(Page page, Test test) {
        return ResponseEntity.ok(testService.queryList(page,test));
//        return ResponseEntity.ok(testService.getList1());
    }

    /**
     * 新增测试表
     * @param test 测试表
     * @return R
     */
    @ApiOperation(value = "新增测试表", notes = "新增测试表")
    @PostMapping
    public ResponseEntity<Object> save(@RequestBody Test test) {
        return ResponseEntity.ok(testService.save(test));
    }
}
